
<div class="box box-success">
    <div class="box-header">
        <h1 class="box-title">基本信息</h1>
    </div>
    <div class="box-body">
        <input type="hidden" name="user_id" class="form-control"
               value="{{ old('user_id') ?: $data->user_id }}">
        <div class="form-group">
            <label class="col-sm-2 control-label">手机号 <b style="color:red">*</b></label>
            <div class="col-sm-5">
                <input type="text" name="phone" class="form-control"
                       value="{{ old('phone') ?: $data->getUser()->phone }}"
                       placeholder="最多30个字符"  disabled>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">币的数量 <b style="color:red">*</b></label>
            <div class="col-sm-5">
                <input type="text" name="number" class="form-control"
                       value="{{ old('number') ?: $data->number }}"
                       placeholder="最多30个字符"  required>
            </div>
        </div>

    </div>
</div>
@section('js')
    <script>
        // 产品logo输入框自动显示已选图片
        $("input[name=image]").change(function () {
            var obj = $(this).parents();
            var img = event.target.files[0];
            var id = 'logo';

            if (!img) {
                if ($('#' + id).length > 0) {
                    $('#' + id).remove()
                }
                return;
            }
            if (window.FileReader) {
                var im = document.createElement('img');
                im.id = id;
                if ($('#logo').length < 1) {
                    obj.append(im);
                }
                ;

                var fr = new FileReader();
                fr.onloadend = function (e) {
                    document.getElementById(id).src = e.target.result;
                    var imgObj = $('#' + id);
                    imgObj.css({
                        'width': '100px',
                        'height': '100px',
                    })
                };
                fr.readAsDataURL(img);
            }
        });
    </script>
@endsection